module Bridgetown
  module Commands
    class Floob < Bridgetown::Command
      self.description = "Florb the floob"

      def call
        puts "YES!"
      end
    end

    register_command :floob, Floob
  end
end

module MyPlugin
  module Commands
    class River < Thor
      include Bridgetown::Commands::ConfigurationOverridable

      include Thor::Actions
      include Bridgetown::Commands::Actions

      Bridgetown::Commands::Registrations.register do
        desc "river <command>", "Take me to the river"
        subcommand "river", River
      end

      desc "bank", "Walk along the river bank"
      option :lolz, aliases: "-l", required: true, type: :numeric
      option :derp, type: :array
      def bank
        puts options[:derp].inspect
        puts "Out for a stroll... #{options[:lolz].class} #{options[:lolz]}"
      end

      desc "flow", "Old man river, he just keeps on rolling along"
      option :destination, desc: "Override configuration file destination", required: true
      def flow
        config = configuration_with_overrides(options)
        destination = config["destination"]

        say_status :river, "Go with the flow! :) to: #{destination}"
      end
    end
  end
end
